package ttt;

import bean.Iterator;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Map;

public class Main {


    public static void main(String[] args) throws InterruptedException, SQLException {

        String sqlAfter = "LIMIT";
        int a = 13666;
        boolean flag = true;

        Iterator iterator = new Iterator();
        iterator.setId(((long) a)+1);

        while (flag){

            //运行截止
            if (a > 532131){
                flag = false;
            }

            int model = 500;
            sqlAfter = sqlAfter +" " + String.valueOf(a) + "," + String.valueOf(model);


            //查询100条okvoice的users数据
            OKvoiceUser oKvoiceUser = new OKvoiceUser();
            Map<String, ArrayList> userMap = oKvoiceUser.selectOVoiceUser(sqlAfter);

            //拼装数据
            String sqlEnd = "(";
            for (Map.Entry<String, ArrayList> entry : userMap.entrySet()) {
                String ok = (String) entry.getValue().get(1);
                sqlEnd+="'"+ok+"'"+",";
            }
            //结尾数据处理
            sqlEnd = sqlEnd.substring(0,sqlEnd.length()-1)+ ")";

            //查询上面的100 pg 数据
            Map<String, ArrayList> pgMap = oKvoiceUser.selectPGUser(sqlEnd);
//        System.out.println(pgMap);

            //遍历  数据对比
            Eachdata eachdata = new Eachdata(userMap,pgMap,iterator);


            //
            a = a+model;
            sqlAfter = "LIMIT";

            System.out.println("sleep……");
            Thread.sleep(2000);

        }
    }

}
